package net.siufung.core.page;

import java.util.List;

/**
 * @author 陈建峰
 * @since 2022/6/22 4:02 下午
 */
public class PagerResult<T> implements IPager<T>{

    private static final long serialVersionUID = 440057266654253213L;
    /**
     * 数据集合
     */
    private List<T> records;
    /**
     * 总条数
     */
    private Long total;
    /**
     * 当前页条数
     */
    private Long pageSize;
    /**
     * 当前页
     */
    private Long pageNo;

    public PagerResult(Long pageNo, Long pageSize, Long total) {
        this(pageNo, pageSize, total, null);
    }

    public PagerResult(Long pageNo, Long pageSize, Long total, List<T> records) {
        this.pageNo = pageNo;
        this.pageSize = pageSize;
        this.total = total;
        this.records = records;
    }

    @Override
    public List<T> getRecords() {
        return this.records;
    }

    @Override
    public IPager<T> setRecords(List<T> records) {
        this.records = records;
        return this;
    }

    @Override
    public Long getTotal() {
        return this.total;
    }

    @Override
    public IPager<T> setTotal(Long total) {
        this.total = total;
        return this;
    }

    @Override
    public Long getPageSize() {
        return this.pageSize;
    }

    @Override
    public IPager<T> setPageSize(Long pageSize) {
        this.pageSize = pageSize;
        return this;
    }

    @Override
    public Long getPageNo() {
        return this.pageNo;
    }

    @Override
    public IPager<T> setPageNo(Long pageNo) {
        this.pageNo = pageNo;
        return this;
    }
}
